toMap

public abstract Map<Object, Object> toMap()

Converts this map to a Map.

The type mapping rules for the map elements are the following:


| JavaScript         | Java           |
|--------------------|----------------|
| Number             | Double         |
| String             | String         |
| Boolean            | Boolean        |
| null and undefined | null           |
| Node               | Node, JsObject |
| ArrayBuffer        | byte[]         |
| Array              | List<?>        |
| Set                | Set<?>         |
| Map                | Map<?,?>       |
| Object             | JsObject       |
| Proxy Object       | Object         |

Proxy objects are mapped to the corresponding injected Java object.

Return

a map containing the converted key-value pairs from this map

Throws

when the JavaScript object is already disposed or invalid


public abstract Map<K, V> toMap<K, V>(Class<K> keyType, Class<V> valueType)

Converts this map to a Map.

The type mapping rules for the map elements are the following:


| JavaScript         | Java           |
|--------------------|----------------|
| Number             | Double         |
| String             | String         |
| Boolean            | Boolean        |
| null and undefined | null           |
| Node               | Node, JsObject |
| ArrayBuffer        | byte[]         |
| Array              | List<?>        |
| Set                | Set<?>         |
| Map                | Map<?,?>       |
| Object             | JsObject       |
| Proxy Object       | Object         |

Proxy objects are mapped to the corresponding injected Java object.

All keys in this map must be of a type convertible to the type K and values must be of a type convertible to the type V according to the mapping rules.

Return

a map containing the converted key-value pairs from this map

Parameters

keyType

the Java type to convert the keys in this map to, according to the mapping rules

valueType

the Java type to convert the values in this map to, according to the mapping rules

<K>

the type of the converted keys

<V>

the type of the converted values

Throws

when the JavaScript object is already disposed or invalid